using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ConversionTools._Excel
{
    /// <summary>
    /// <para>Table To Excel</para>
    /// <para>Converts  a table to a Microsoft Excel file (.xls or .xlsx).</para>
    /// <para>将表格转换为Microsoft Excel 文件（.xls 或 .xlsx）。</para>
    /// </summary>    
    [DisplayName("Table To Excel")]
    public class TableToExcel : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public TableToExcel()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_Input_Table">
        /// <para>Input Table</para>
        /// <para>The table to be converted to Microsoft Excel.</para>
        /// <para>要转换为 Microsoft Excel 的表。</para>
        /// </param>
        /// <param name="_Output_Excel_File">
        /// <para>Output Excel File (.xls or .xlsx)</para>
        /// <para>The output Excel file. Specify the format of the Excel file using an .xls or .xlsx file extension.</para>
        /// <para>输出 Excel 文件。使用 .xls 或 .xlsx 文件扩展名指定 Excel 文件的格式。</para>
        /// </param>
        public TableToExcel(object _Input_Table, object _Output_Excel_File)
        {
            this._Input_Table = _Input_Table;
            this._Output_Excel_File = _Output_Excel_File;
        }
        public override string ToolboxName => "Conversion Tools";

        public override string ToolName => "Table To Excel";

        public override string CallName => "conversion.TableToExcel";

        public override List<string> AcceptEnvironments => ["scratchWorkspace", "transferDomains", "transferGDBAttributeProperties", "workspace"];

        public override object[] ParameterInfo => [_Input_Table, _Output_Excel_File, _Use_field_alias_as_column_header.GetGPValue(), _Use_domain_and_subtype_description.GetGPValue()];

        /// <summary>
        /// <para>Input Table</para>
        /// <para>The table to be converted to Microsoft Excel.</para>
        /// <para>要转换为 Microsoft Excel 的表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Input_Table { get; set; }


        /// <summary>
        /// <para>Output Excel File (.xls or .xlsx)</para>
        /// <para>The output Excel file. Specify the format of the Excel file using an .xls or .xlsx file extension.</para>
        /// <para>输出 Excel 文件。使用 .xls 或 .xlsx 文件扩展名指定 Excel 文件的格式。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Excel File (.xls or .xlsx)")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Output_Excel_File { get; set; }


        /// <summary>
        /// <para>Use field alias as column header</para>
        /// <para><xdoc>
        ///   <para>Specifies how column names in the output are determined.</para>
        ///   <bulletList>
        ///     <bullet_item>Unchecked—Column headers will be set using the input's field names. This is the default.</bullet_item><para/>
        ///     <bullet_item>Checked—Column headers will be set using the input geodatabase table's field aliases. If the input is a layer in a map, the value set on the layer's field alias is ignored.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定如何确定输出中的列名。</para>
        ///   <bulletList>
        ///     <bullet_item>未选中 - 将使用输入的字段名称设置列标题。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>选中 - 将使用输入地理数据库表的字段别名设置列标题。如果输入是地图中的图层，则忽略在图层的字段别名上设置的值。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Use field alias as column header")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _Use_field_alias_as_column_header_value _Use_field_alias_as_column_header { get; set; } = _Use_field_alias_as_column_header_value._false;

        public enum _Use_field_alias_as_column_header_value
        {
            /// <summary>
            /// <para>ALIAS</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("ALIAS")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NAME</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NAME")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Use domain and subtype description</para>
        /// <para><xdoc>
        ///   <para>Controls how values from subtype fields or fields with a coded value domain are transferred to the output.</para>
        ///   <bulletList>
        ///     <bullet_item>Unchecked—All field values will be used as they are stored in the table. This is the default.</bullet_item><para/>
        ///     <bullet_item>Checked—For subtype fields, the subtype description will be used. For fields with a coded value domain, the coded value descriptions will be used.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>控制如何将子类型字段或具有编码值属性域的字段中的值传输到输出。</para>
        ///   <bulletList>
        ///     <bullet_item>未选中 - 将使用所有字段值，因为它们存储在表中。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>选中 - 对于子类型字段，将使用子类型描述。对于具有编码值属性域的字段，将使用编码值描述。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Use domain and subtype description")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _Use_domain_and_subtype_description_value _Use_domain_and_subtype_description { get; set; } = _Use_domain_and_subtype_description_value._false;

        public enum _Use_domain_and_subtype_description_value
        {
            /// <summary>
            /// <para>DESCRIPTION</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("DESCRIPTION")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>CODE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("CODE")]
            [GPEnumValue("false")]
            _false,

        }

        public TableToExcel SetEnv(object scratchWorkspace = null, bool? transferDomains = null, object workspace = null)
        {
            base.SetEnv(scratchWorkspace: scratchWorkspace, transferDomains: transferDomains, workspace: workspace);
            return this;
        }

    }

}